class Task48:
    def run(self, string):
        if len(string) == 0:
            return 0

        length = 1
        max_length = length
        for i in range(1, len(string)):
            for j in reversed(range(i - length, i)):
                if string[j] == string[i]:
                    length = i - j - 1
                    break
            length += 1
            max_length = max(length, max_length)

        return length
